//
//  SearchTwoController.m
//  TouTiao
//
//  Created by 杜倩 on 16/9/14.
//  Copyright © 2016年 Match. All rights reserved.
//

#import "SearchTwoController.h"
#import "TitleBar.h"
@interface SearchTwoController ()<UISearchBarDelegate>
@property(nonatomic,strong)TitleBar *title1;

@property(nonatomic,strong)UIButton *button;//左边的返回按钮
@property(nonatomic,strong)UIButton *searchBtn;//搜索按钮

@end

@implementation SearchTwoController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置导航栏的背景颜色
    [self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];
    [self addBtn];//添加搜索栏和搜索按钮
    self.navigationItem.hidesBackButton = YES;//隐藏返回按钮
    _title1.delegate = self;
    
}

#pragma mark 添加搜索栏和搜索按钮
-(void)addBtn{
    _title1 = [[TitleBar alloc] init];
    _title1.placeholder=@"搜你要关注的";
    _title1.showsCancelButton = YES;
    self.navigationItem.titleView = _title1;
    [_title1 becomeFirstResponder];
    _title1.autocapitalizationType=UITextAutocapitalizationTypeNone;
}

#pragma mark 取消按钮
-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
    self.tabBarController.tabBar.hidden=NO;//返回显示标签栏
    [self.navigationController popToRootViewControllerAnimated:YES];//返回上一级控制器
}


@end
